#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import hashlib

s = '我是李迪'
# 把string转为字节
s = s.encode('utf-8')

# method 1
# 实例化一个md5
m = hashlib.md5()
m.update(s)
res1 = m.hexdigest()

# method 2
res2 = hashlib.md5(s).hexdigest()


print('res1: ', res1)
print('res2: ', res2)
